package com.yixin.hospital.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yixin.hospital.common.ApiResult;
import com.yixin.hospital.entity.domain.JobType;
import com.yixin.hospital.entity.dto.req.jobType.JobTypeAddReqDTO;
import com.yixin.hospital.entity.dto.req.jobType.JobTypeEditReqDTO;
import com.yixin.hospital.service.JobTypeService;
import com.yixin.hospital.mapper.JobTypeMapper;
import org.springframework.stereotype.Service;

/**
* @author 
* @description 针对表【job_type(工作类型表)】的数据库操作Service实现
* @createDate 2024-03-28 21:37:13
*/
@Service
public class JobTypeServiceImpl extends ServiceImpl<JobTypeMapper, JobType>
    implements JobTypeService{

    @Override
    public ApiResult add(JobTypeAddReqDTO jobTypeAddReqDTO, String userName) {
        JobType jobType = new JobType();
        jobType.setName(jobTypeAddReqDTO.getName());
        jobType.setCreatedBy(userName);
        jobType.setUpdatedBy(userName);
        this.save(jobType);
        return ApiResult.success();
    }

    @Override
    public ApiResult edit(JobTypeEditReqDTO jobTypeEditReqDTO, String userName) {
        JobType jobType = new JobType();
        jobType.setId(jobTypeEditReqDTO.getId());
        jobType.setName(jobTypeEditReqDTO.getName());
        jobType.setUpdatedBy(userName);
        this.updateById(jobType);
        return ApiResult.success();
    }
}




